<template>
    <el-tag v-if="dictname">{{ dictname }}</el-tag>
    <el-tag v-else>2</el-tag>

</template>


<script setup>
import { computed, watchEffect } from 'vue';


const dictname = ref('');

const props = defineProps({
    dictcode: {
        type: [String, Number],
        require: true,
    },

    dictmap: {
        type: Array,
        require: true,
        default: []
    }
});

watchEffect(() => {
    let dictdata = props.dictmap.find(x => x.code == props.dictcode);
    if (dictdata) {
        dictname.value = dictdata.name;
    }
});


</script>
